load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("sapling")

rust_library(
    name = "commitcloudsubscriber",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "lib": {"name": "commitcloudsubscriber"},
        "package": {
            "authors": ["Meta Source Control Team <sourcecontrol-dev@meta.com>"],
            "description": "    Cross platform client for subscribing to Commit Cloud eventsource (http server-sent events)\n    The workflow is the following:\n    * define 'subscription' as a unique [repo_name, workspace] pair\n    * read set of 'subscribers', defined as [repo_name, workspace, repo_root]\n    * runs a Commit Cloud eventsource listener in a separate thread for every 'subscription'\n        (and a set of 'subscribers' (repo_roots))\n    * triggers `hg cloud sync` command on notifications in all 'subscribers' (repo_roots)\n        for a given 'subscription'\n    * the library also contains a module to find OAuth token,\n        this logic should be in sync with `hg cloud auth` command.\n",
            "homepage": "https://sapling-scm.com/",
            "license": "MIT",
            "name": "sapling-commitcloudsubscriber",
            "repository": "https://github.com/facebook/sapling",
        },
    }},
    crate_root = "src/lib.rs",
    test_deps = ["fbsource//third-party/rust:tempfile"],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:base64",
        "fbsource//third-party/rust:filetime",
        "fbsource//third-party/rust:lazy_static",
        "fbsource//third-party/rust:log",
        "fbsource//third-party/rust:mime",
        "fbsource//third-party/rust:parking_lot",
        "fbsource//third-party/rust:regex",
        "fbsource//third-party/rust:reqwest",
        "fbsource//third-party/rust:serde",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "//common/rust/shed/hostcaps:hostcaps",
        "//eden/scm/lib/config/set:configset",
        "//eden/scm/lib/identity:identity",
    ],
)
